feat(runtime): /discovery 单一归属 + /packages 统一管线(ADR-0076 D11 步骤②)#3142
Merged
Conversation
…es (ADR-0076 D11 step 2)
OQ#9 flagged discovery and packages as the two genuinely double-mounted
domains between the REST server and the dispatcher bridge, with
first-registration-wins deciding which implementation a client saw.
- kernel: new public hasPlugin(name) — plugins can make composition-
dependent decisions deterministically during their own start().
- dispatcher bridge: cede ${prefix}/discovery to com.objectstack.rest.api
when that plugin is registered; keep it only as the fallback owner in
REST-less compositions. /.well-known/objectstack stays dispatcher-owned
(no other registrant).
- dispatcher bridge: the /packages route family now flows through
dispatch() (like analytics/i18n/automation/AI) instead of calling
handlePackages() directly, so the explicit mounts and the cloud hosts'
@objectstack/hono catch-all share one per-request pipeline (kernel
resolution, identity, auth gate). The direct path also dropped
req.query on several routes — the documented ?overwrite=true install
flag never reached the handler over the mounted routes.
- ADR-0076 OQ#9: record step 2 as shipped and re-scope step 1 with the
cross-repo finding — the 'dead' dispatch() branches are the cloud
hosts' fallback fabric via the createHonoApp catch-all (/share-links
is the designed primary surface for per-env kernels; /notifications
has no other HTTP owner), so killing them waits for per-domain
handlers (step 3).
Refs #2462
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A1BtxNeUaGmvUYr8FwtUNu
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 32 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
marked this pull request as ready for review
July 17, 2026 13:43
6 tasks
This was referenced Jul 27, 2026
os-zhuang
added a commit
that referenced
this pull request
Jul 27, 2026
…1 step ③ PR-5 (#2462) (#3537) The largest extraction so far: handlePackages (~470 lines) plus its two EXCLUSIVE helpers assemblePackageManifest and applyPublishedSeeds (~190 more) move to domains/packages.ts. resolveActiveOrganizationId stays on the dispatcher (metadata-domain call sites share it) and is exposed through deps instead. DomainHandlerDeps grows: errorFromThrown (spec-validation issues carry through as field-anchored 422s), resolveActiveOrganizationId, announceKernelEvent (the metadata:reloaded publish announcement — the domain keeps the changed-list check, the deps side owns the trigger-existence check), and optional logger (seed-loader falls back to console as before). The dynamic './seed-loader.js' import moved to '../seed-loader.js' (the PR#2415 lesson: dynamic imports are the extraction landmine — this time the import moved WITH the caller). Step-② (#3142) single-pipeline behavior preserved; the '/packages' bare-startsWith match is reproduced as-is. Verified: seam suite 34 tests (4 new incl. the 409 duplicate-install guard + ?overwrite=true), runtime 639 green, http-conformance 41 green, dependent closure builds with DTS (--force). Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
OQ#9 审计(#2462, ADR-0076)确认 discovery 与 packages 是 REST server 与 dispatcher bridge 之间仅有的两处真双挂载,先注册者赢——客户端看到哪个实现取决于插件启动顺序。本 PR 落地 D11 worklist 步骤②「packages + discovery 单一归属」。
变更
kernel.hasPlugin(name)——注册在任何 start() 之前同步完成,插件可在自身 start() 中做确定性的组合判断。com.objectstack.rest.api已注册时,让出${prefix}/discovery(REST 为确定性 owner);无 REST 的组合中保留兜底注册。/.well-known/objectstack始终由 dispatcher 独有(无其他注册方)。/packages全家族路由改走dispatch()(与 analytics/i18n/automation/AI 一致),不再直连handlePackages()——显式挂载与 cloud host 的createHonoAppcatch-all 两个入口共享同一条 per-request 管线(kernel 解析、身份解析、auth gate)。顺带修复:直连路径多处丢弃req.query,文档化的?overwrite=true安装标志在挂载路由上从未生效。/share-links是 per-env kernel 的设计主通道,cloud 两处注释明确记载;/notifications在任何地方都没有其他 HTTP owner),kill 需等步骤③(per-domain handlers)取代 catch-all 之后。验证
@objectstack/core360、@objectstack/runtime546、@objectstack/rest298、@objectstack/http-conformance41(双 adapter 集成门禁)全绿Refs #2462(ADR-0076 D11)
🤖 Generated with Claude Code
https://claude.ai/code/session_01A1BtxNeUaGmvUYr8FwtUNu
Generated by Claude Code